const HOST = 'http://127.0.0.1:8000';

Vue.filter('str_date',function (value) {
    return new Date(value)
});

Vue.filter('date_ymd',function (value) {
    return value.getFullYear() + '-' + (value.getMonth() + 1) + '-' + value.getDate()
});

Vue.filter('date_mdhm',function (value) {
    var minutes=value.getMinutes()<10 ? "0"+value.getMinutes() : value.getMinutes();
    return (value.getMonth() + 1) + '月' + value.getDate() + '日'+ ' ' + value.getHours() + ':' + minutes
});

Vue.filter('date_hm',function (value) {
     return value.getHours() + ':' + value.getUTCMinutes()
});

const WEEKS = ['周日','周一','周二','周三','周四','周五','周六',];
Vue.filter('date_week',function (value) {
    return WEEKS[value.getDay()]
});


function get_query_string(name,a) {
    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
    var r = window.location.search.substr(1).match(reg);
    if (r != null) {
        return decodeURI(r[2]);
    }
    return a;
};


function content_length () {
/*处理label显示问题，超出宽度，裁剪，并省略号，其他组件文字显示问题一样*/
$("p") .each(function(){
    var labelval= $(this).text() ;
    if(labelval.length>80){
    $(this).text(labelval.substring(0,80)+"...");
}
});
}


Vue.filter('content_length',function (value) {
    return value.slice(0,80)

});
const HOST = 'http://127.0.0.1:8000/';

Vue.filter('str_date',function (value) {
    return new Date(value)
});

Vue.filter('date_ymd',function (value) {
    return value.getFullYear() + '-' + (value.getMonth() + 1) + '-' + value.getDate()
});

Vue.filter('date_hm',function (value) {
     return value.getHours() + ':' + value.getUTCMinutes()
});

const WEEKS = ['周日','周一','周二','周三','周四','周五','周六',];
Vue.filter('date_week',function (value) {
    return WEEKS[value.getDay()]
});


function get_query_string(name,a) {
    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
    var r = window.location.search.substr(1).match(reg);
    if (r != null) {
        return decodeURI(r[2]);
    }
    return a;
};